//
//  QuanBuViewController.m
//  ECO
//
//  Created by zl on 2019/10/12.
//  Copyright © 2019 谷银行. All rights reserved.
//

#import "QuanBuViewController.h"
#import "OrderdetailTableViewCell.h"
@interface QuanBuViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic , strong)UITableView *ojtable;
@property(nonatomic , strong)NSMutableArray *DataArray;
@end

@implementation QuanBuViewController
- (UITableView *)ojtable{
    if (!_ojtable) {
        _ojtable = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - 100)];
        _ojtable.delegate = self;
        _ojtable.dataSource = self;
        _ojtable.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return _ojtable;
}
- (NSMutableArray *)DataArray{
    if (!_DataArray) {
        _DataArray = [[NSMutableArray alloc]init];
    }
    return _DataArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.ojtable];
    [self QuanBuLoadData];
}
// 订单列表
- (void)QuanBuLoadData{
    NSDictionary *dict = @{
                        @"appUserId":self.appUserId,
                        @"PC":@"PC",
                        @"payStatus":self.page_index,
                        @"page_index":@"1"
                        };
    NSLog(@"%@",dict);
    [HttpsTool get:@"/1.0/kf/order/detil/list" params:dict success:^(id response) {
        NSLog(@"订单列表 : %@",response);
        SetModel *model = [SetModel yy_modelWithJSON:response];
        self.DataArray = [model.data yy_modelToJSONObject];
        
        dispatch_async(dispatch_get_main_queue(), ^{
            [self.ojtable reloadData];
        });
    } failure:^(NSError *error) {
        NSLog(@"订单列表 : %@",error);
    }];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.DataArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    OrderdetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[OrderdetailTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
//    cell.imgV.image = [UIImage imageNamed:@"头像"];
//    cell.Title.text = @"ANOS夏季白衬衫男长袖商务免烫衬衣韩版…";
//    cell.money.text = @"￥160.00";
//    cell.FanLabel.text = @"返1.00";
//    cell.Status.text = @"已结算";
//    cell.OrderNumber.text = @"订单号：16157326560563369";
//    cell.OrderTime.text = @"下单时间：2019-08-21  09 : 21 : 00";
//    cell.CutoffTime.text = @"结算时间：2019-08-21  19 : 21 : 00";
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 260;
}

@end
